#ifndef __SPI_API_H__
#define __SPI_API_H__

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/spi/spidev.h>
#include <string.h>
 
#define SPI_DEVICE_PATH "/dev/spidev0.0"    //设备节点
#define FLASH_PAGE_SIZE 256     //页大小

typedef enum
{
	SPIMODE0  =   SPI_MODE_0,
	SPIMODE1  =   SPI_MODE_1,
	SPIMODE2  =   SPI_MODE_2,
	SPIMODE3  =   SPI_MODE_3,
}SPI_MODE;
 
typedef enum
{
    S_5_00M     =   500000,
	S_6_75M  	=   6750000,
	S_13_5M  	=   13500000,
	S_27M  		=   27000000,
}SPI_SPEED;

int spi_remap0();
int spi_remap1();

int spi_init(int* spi_fd);
int spi_uninit(int *spi_fd);

#endif /*__SPI_API_H__*/